# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgbase=libqaccessibilityclient
pkgname=(libqaccessibilityclient-qt5
         libqaccessibilityclient-qt6)
pkgver=0.5.0
pkgrel=2
arch=(loong64 x86_64)
pkgdesc='Helper library to make writing accessibility tools easier'
url='https://www.kde.org'
license=(LGPL2.1)
depends=(gcc-libs
         glibc)
makedepends=(extra-cmake-modules
             qt5-base
             qt6-base)
source=(https://download.kde.org/stable/$pkgbase/$pkgbase-$pkgver.tar.xz{,.sig})
sha256sums=('704772543a3b005b94061a53eaf9f9d64944e6818b04c59c0fb0a503c81ac4a0'
            'SKIP')
validpgpkeys=(FB25861861063C64C97B89AE125C53EB96EC0C92  # Frederik Gladhorn <frederik@gladhorn.de>
              E0A3EB202F8E57528E13E72FD7574483BB57B18D) # Jonathan Esk-Riddell <jr@jriddell.org>

build() {
  cmake -B build5 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_TESTING=OFF
  cmake --build build5

  cmake -B build6 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DQT_MAJOR_VERSION=6 \
    -DBUILD_TESTING=OFF
  cmake --build build6
}

package_libqaccessibilityclient-qt5() {
  depends+=(qt5-base)
  conflicts=(libqaccessibilityclient)
  provides=(libqaccessibilityclient)
  replaces=(libqaccessibilityclient)

  DESTDIR="$pkgdir" cmake --install build5
}

package_libqaccessibilityclient-qt6() {
  depends+=(qt6-base)

  DESTDIR="$pkgdir" cmake --install build6
}
